package game.ui
{
	import com.yzy.models.SetLibs;
	
	import flash.geom.Point;
	
	import models.ProfileModel;
	
	import starling.display.Sprite;
	import starling.textures.Texture;
	import starling.textures.TextureAtlas;
	
	public class GameUI extends Sprite
	{
		
		private var _numberframes:Vector.<Texture>=new Vector.<Texture>();
		
		public function getnumberframes():Vector.<Texture>
		{
			return _numberframes;
		}

//		public function setnumberframes(value:Texture):void
//		{
//			_numberframes.push(value);
//		}
		private var score:NumberMC;
		
		public function GameUI()
		{
			super();
		}
		

		public function init():void{
			//上传素材
			var name:String="number";
			var monsterxml:XML=new XML(String(SetLibs.getLibsData(name)));
			var monsterTexture:Texture=Texture.fromBitmapData(SetLibs.getBitmapData(name));
			var stextureAtlas:TextureAtlas=new TextureAtlas(monsterTexture,monsterxml);
			_numberframes=stextureAtlas.getTextures(name);
			//
			score=new NumberMC();
			this.addChild(score);
			score.setScoreNum();
			score.x=400;
			ProfileModel.instant._runVec.push(score);
		}
		
		public function setMultiple(num:int,place:Point):void{
			var nmc:NumberMC=new NumberMC();
			nmc.setMultiple(num);
			nmc.x=place.x;
			nmc.y=place.y;
			this.addChild(nmc);
			
			ProfileModel.instant._runVec.push(nmc);
		}
		
		public function setScore(num:Number):void{
			score.setScoreNum(num);
			ProfileModel.instant._runVec.push(score);
		}
		
		//*****************************************************
		// Singleton 
		//*****************************************************
		private static var _instant:GameUI;
		public static function get instant():GameUI
		{
			if(null == _instant)
			{
				_instant =  new GameUI();
			}
			return _instant;
		}
	}
}